package springIOC.IOC_XML.controller;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import springIOC.IOC_XML.beans.User;
import springIOC.IOC_XML.service.UserService;

public class Controller {
    UserService service=null;
//    User user=null;

    public UserService getService() {
        return service;
    }

    public void setService(UserService service) {
        this.service = service;
    }

    public static void main(String[] args) {
//        Controller controller=new Controller();
        ApplicationContext context=new ClassPathXmlApplicationContext("bean.xml");

        Controller controller=(Controller)context.getBean("controller");

        System.out.println(controller.getService().findUserByID(10));

        System.out.println("------------------------------------------------");
        System.out.println(controller.getService().getAccount().toString());
    }
}
